<template>
  <div class="box" ref="targetElement">
    <div class="search-box" ref="searchBox">
      <div class="search-top-box">
        <div class="search-top-left-box">
          <el-form label-width="110px" ref="div" :inline="true" :model="formSearch" @submit.native.prevent
            class="demo-form-inline">
            <el-form-item label="项目名称">
              <el-input @change="onSearch(1)" clearable class="form-width" v-model="formSearch.project_name"
                placeholder="输入项目名称"></el-input>
            </el-form-item>
            <el-form-item label="项目品牌">
              <el-select @change="onSearch(1)" v-model="formSearch.brand_id" filterable clearable placeholder="选择项目品牌"
                class="form-width">
                <el-option v-for="(item, idx) in brandList" :label="item.name" :value="item.id" :key="idx"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="增减类型">
              <el-select filterable @change="onSearch(1)" v-model="formSearch.increase_or_decrease" clearable
                placeholder="选择增减类型" class="form-width">
                <el-option label="增项" :value="1"></el-option>
                <el-option label="减项" :value="2"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="创建时间">
              <el-date-picker @change="onSearch(1)" v-model="formSearch.created_at" type="daterange" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期" class="form-width" value-format="yyyy-MM-dd">
              </el-date-picker>
            </el-form-item>
            <template v-if="moreSearchShow">
              <el-form-item label="项目编号">
                <el-input @change="onSearch(1)" clearable class="form-width" v-model="formSearch.project_number"
                  placeholder="输入项目编号"></el-input>
              </el-form-item>
              <el-form-item label="项目类型">
                <el-select filterable @change="onSearch(1)" v-model="formSearch.store_type_id" clearable
                  placeholder="选择项目类型" class="form-width">
                  <el-option v-for="(item, idx) in storeList" :label="item.store_type_name" :value="item.id"
                    :key="idx"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="报价时间">
                <el-date-picker @change="onSearch(1)" v-model="formSearch.quotation_at" type="daterange"
                  value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
                  class="form-width">
                </el-date-picker>
              </el-form-item>
              <el-form-item label="增减项报价时效">
                <el-input @change="onSearch(1)" clearable class="form-width" v-model="formSearch.quotation_validity"
                  placeholder="输入增减项报价时效">
                  <span slot="suffix">天</span>
                </el-input>
              </el-form-item>
            </template>
          </el-form>
        </div>
        <div class="search-top-right-box">
          <p @click="moreSearchFunc">
            {{ moreSearchShow ? "收起" : "展开"
            }}<i :class="moreSearchShow ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
              "></i>
          </p>
          <el-button type="primary" @click="onSearch">查询</el-button>
          <el-button type="primary" @click="addFunc"
            v-if="$isPer(permission, ['increaseDecreaseItems_add'])">新增增减项</el-button>
        </div>
      </div>
    </div>
    <!-- table -->
    <div class="page-list" ref="pageList">
      <div class="list-top-box">
        <div class="tab-box">
          <el-tabs v-model="formSearch.to_do" @tab-click="onSearch(1)">
            <el-tab-pane label="全部" name="0"></el-tab-pane>
            <el-tab-pane label="待处理" name="1"></el-tab-pane>
          </el-tabs>
        </div>
        <div class="list-top-box-right">
          <p class="list-top-box-left">
            已选 <span class="num">{{ multipleSelection.length }}</span>/{{ tableData.length }} 数据
          </p>
          <el-button type="primary" @click="exportVisible = true" :disabled="tableData.length == 0"
            v-if="$isPer(permission, ['preSettlement_exportChangeExcel'])">导出增减项列表</el-button>
          <el-button type="primary" :disabled="bottonDisabled(4, 10)" @click="editFunc(0)"
            v-if="$isPer(permission, ['projects_changeItemsAssignCostEstimator'])">修改负责人</el-button>
          <!-- userInfo.position_id == 5 && changeInfo.change_status == 10 -->
          <el-button type="primary" :disabled="bottonDisabled(5, 10)" @click="editFunc(1)"
            v-if="$isPer(permission, ['increaseDecreaseItems_cjbjd'])">出具报价单</el-button>
          <!-- userInfo.position_id == 7 && changeInfo.change_status == 20 -->
          <el-button type="primary" :disabled="bottonDisabled(7, 20)" @click="editFunc(2)"
            v-if="$isPer(permission, ['increaseDecreaseItems_shbjd1'])">报价单审核</el-button>
          <!-- userInfo.position_id == 4 && changeInfo.change_status == 30 -->
          <el-button type="primary" :disabled="bottonDisabled(4, 30)" @click="editFunc(3)"
            v-if="$isPer(permission, ['increaseDecreaseItems_shbjd2'])">报价单复审</el-button>
          <el-button type="primary" :disabled="bottonDisabled(2, 40)" @click="editFunc(4)"
            v-if="$isPer(permission, ['increaseDecreaseItems_shbjd3'])">报价单三审</el-button>
          <el-button type="primary" :disabled="!multipleSelection.length" @click="changeInvalidationFunc"
            v-if="$isPer(permission, ['projects_changeInvalidation'])">作废</el-button>
        </div>
      </div>
      <div class="table-box" v-loading="tableLoading">
        <el-table ref="table" :header-cell-style="{
          background: '#FAFBFC',
          color: '#828A9D',
          textAlign: 'center',
        }" :cell-style="{ textAlign: 'center', color: '#1B2431' }" :data="tableData" border highlight-selection-row
          @selection-change="handleSelectionChange" @row-click="handleHighlightChangeTable" height="100%">
          <el-table-column type="selection" width="80"></el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxbh')" min-width="182px" prop="change_number" label="增减项编号"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <el-button v-if="$isPer(permission, ['increaseDecreaseItems_detail'])" type="text"
                @click.stop="goToDetail(scope.row)">{{ scope.row.change_number }}</el-button>
              <span v-else>{{ scope.row.change_number }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_xmmc')" min-width="180px" prop="project_name" label="项目名称"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_xmbh')" min-width="130px" prop="project_number" label="项目编号"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_xmpp')" min-width="120px" prop="brand_name" label="项目品牌"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag :color="`${scope.row.brand_colour}`" style="color: #ffffff;">
                {{ scope.row.brand_name }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_xmlx')" min-width="120px" prop="store_type_name" label="项目类型"
            show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.store_type_name ?? '--' }}
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjlx')" min-width="90px" prop="increase_or_decrease" label="增减类型">
            <template slot-scope="scope">
              <span>{{ scope.row.increase_or_decrease == 1 ? '增项' : '减项' }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjnr')" min-width="100px" prop="change_content" label="增减内容"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.change_content }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxzt')" min-width="100px" prop="change_status" label="增减项状态"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span v-if="scope.row.change_status == 10">待出具</span>
              <span v-if="scope.row.change_status == 20">待初审</span>
              <span v-if="scope.row.change_status == 25">初审拒绝</span>
              <span v-if="scope.row.change_status == 30">待复审</span>
              <span v-if="scope.row.change_status == 35">复审拒绝</span>
              <span v-if="scope.row.change_status == 40">待终审</span>
              <span v-if="scope.row.change_status == 45">终审拒绝</span>
              <span v-if="scope.row.change_status == 60">已完成</span>
              <span v-if="scope.row.change_status == 70">作废</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxcjsj')" min-width="180px" prop="created_at" label="创建时间"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxje')" min-width="110px" prop="quotation_amount" label="增减项金额"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.change_amount ? `${scope.row.increase_or_decrease == 1 ? '' :
                '-'}${scope.row.change_amount}元` : '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_cbje')" min-width="110px" prop="cost_amount" label="成本金额"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.cost_amount ? `${scope.row.increase_or_decrease == 1 ? '' :
                '-'}${scope.row.cost_amount}元` : '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_lrje')" min-width="110px" prop="profit_amount" label="利润金额"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.profit_amount ? `${scope.row.increase_or_decrease == 1 ? '' :
                '-'}${scope.row.profit_amount}元` : '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxyy')" min-width="180px" prop="reason_type" label="增减项原因">
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_bjsj')" min-width="180px" prop="quotation_created_at" label="报价时间"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.quotation_created_at ?? '--' }}</span>
            </template>
          </el-table-column>
          <el-table-column v-if="$fieldShowFunc('zjx_zjxbjsx')" min-width="130px" prop="project_name" label="增减项报价时效"
            show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{ scope.row.quotation_validity }}天</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="page-footer">
        <el-pagination class="el-pagination" @current-change="handleCurrentChange" :current-page="page" :page-size="num"
          @size-change="handleSizeChange" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
      </div>
    </div>

    <!-- 导出增减项列表 -->
    <el-dialog :modal-append-to-body="false" title="导出增减项列表字段选择" :visible.sync="exportVisible" width="680px"
      :before-close="exportCloseFunc">
      <el-checkbox class="checkbox-item" v-model="allChecked" @change="allCheckedChangeFunc">全选</el-checkbox>
      <div v-loading="exportLoading">
        <div class="export-scroll">
          <el-checkbox-group v-model="exportrVal">
            <el-checkbox class="checkbox-item" v-for="(item, index) in exportArr" :key="index" :label="item.label"
              border></el-checkbox>
          </el-checkbox-group>
        </div>
        <p v-if="exportUrl">导出文件链接：<el-button @click="$openUrlFunc(exportUrl[0])" type="text">{{
          exportUrl[1]
            }}</el-button></p>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="exportSubmitFunc">提交</el-button>
        <el-button @click="exportCloseFunc">关闭</el-button>
      </span>
    </el-dialog>

    <!-- 人员修改 -->
    <el-dialog :modal-append-to-body="false" :close-on-click-modal="false" destroy-on-close title="人员修改"
      :visible.sync="changeManVisible" width="500px" @close="changeManCancelFunc">
      <el-form ref="form" :model="changeManForm" :rules="changeManRules" label-width="100px" v-loading="changeLoading">
        <el-form-item label="职位">
          <el-select filterable disabled class="change-man-input" value="0" placeholder="选择">
            <el-option label="造价员" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="造价员" prop="admin_id">
          <el-select filterable class="input-box" v-model="changeManForm.admin_id" placeholder="请选择造价员">
            <el-option v-for="(item, idx) in adminList" :key="idx" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="changeManSubmit" :loading="changeLoading">提 交</el-button>
        <el-button @click="changeManCancelFunc">关闭</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
import idiApi from '@/api/increaseDecreaseItemsApi'
import brandApi from '@/api/brandApi'
import storeTypeApi from '@/api/storeTypeApi'
import adminApi from "@/api/adminApi";
import { handleSpeedDesc } from "@/views/home/components/kj.js";
import { getUserInfo } from '@/utils/auth';
import { exportChangeFideldArr } from '@/utils/exportField'
import preSettlementApi from "@/api/preSettlementApi";

export default {
  name: "increaseDecreaseItemsList",
  data() {
    return {
      // 导出用户列表
      allChecked: false,//是否全选字段
      exportLoading: false,//导出loading
      exportVisible: false,//导出弹窗
      exportUrl: '',//导出url
      exportrVal: [],//导出勾选字段
      exportArr: exportChangeFideldArr,//导出字段数组


      brandList: [],
      storeList: [],

      userInfo: {},
      tableLoading: false,//列表loading
      tableData: [],//列表数据
      formSearch: {
        to_do: '0',
        project_name: '',
        project_number: '',
        brand_id: '',
        store_type_id: '',
        increase_or_decrease: '',
        created_at: null,
        quotation_at: null,
        // quotation_day: ''
      },//搜索form
      moreSearchShow: false,//
      page: 1,
      num: 10,
      total: 0,
      multipleSelection: [],//多选数据
      permission: [],//操作权限

      // 修改人员
      adminList: [],
      changeManVisible: false,
      changeLoading: false,
      changeManForm: {
        admin_id: '',
      },
      changeManRules: {
        admin_id: { required: true, message: "请选择造价员", trigger: "change" },
      },
    };
  },
  watch: {},
  computed: {
    speedDesc() {
      return (type, item) => {
        return handleSpeedDesc(type, item, this.userInfo);
      }
    }
  },
  activated() {
    // 监听窗口大小变化事件
    window.addEventListener('resize', this.handleResize);
    this.hrefQueryFunc(() => {
      this.onSearch()
    })
  },
  destroyed() {
    window.removeEventListener('resize', this.handleResize);
    // 移除窗口大小变化事件监听器，防止内存泄漏
    if (this.resizeObserver) {
      // 停止观察目标元素，防止内存泄漏
      this.resizeObserver.disconnect();
    }
  },
  deactivated() {
    window.removeEventListener('resize', this.handleResize);
    // 移除窗口大小变化事件监听器，防止内存泄漏
    if (this.resizeObserver) {
      // 停止观察目标元素，防止内存泄漏
      this.resizeObserver.disconnect();
    }
  },
  mounted() {
    this.handleResize();
    // 监听窗口大小变化事件
    window.addEventListener('resize', this.handleResize);
    console.log(this.$route.path)
    // 操作权限
    this.$getHtmlAuthority(this.$route.path).then(res => {
      console.log(res, "getHtmlAuthority");
      this.permission = res.data.permission;
    })
    this.hrefQueryFunc(() => {
      this.getList();
      this.getBrandList()
      this.getStoreList()
    })
    this.userInfo = getUserInfo();
  },
  methods: {
    handleResize() {
      const target = this.$refs.targetElement;
      const searchBox = this.$refs.searchBox;
      const pageList = this.$refs.pageList;
      // 创建 ResizeObserver 实例
      const resizeObserver = new ResizeObserver(entries => {
        setTimeout(() => {
          console.log('元素变为:', searchBox.offsetHeight);
          // searchBox.offsetHeight + 'px'
          pageList.style.height = 'calc(100% - ' + (searchBox.offsetHeight + 15) + 'px)';
        }, 0);
      });
      // 开始观察目标元素
      resizeObserver.observe(target);

      // 存储 resizeObserver 实例，以便在组件销毁时停止观察
      this.resizeObserver = resizeObserver;
    },
    // 跳转判断的
    hrefQueryFunc(cb) {
      let query = this.$route.query;
      if (JSON.stringify(query) != "{}") {
        this.formSearch.project_name = query.project_name || '';//筛选项目名
        this.formSearch.to_do = query.to_do || '0';//是否待处理
      }
      cb && cb();
    },
    // 导出列表确认
    exportSubmitFunc() {
      let exportrVal = this.exportrVal;//已勾选
      let exportArr = this.exportArr;//所有字段
      let formSearch = this.formSearch;//列表筛选项
      if (!exportrVal.length) {
        this.$message({
          type: 'warning',
          message: "请勾选需要导出的字段"
        })
        return;
      }
      let field_list = [];//提交列表
      exportrVal.forEach(item => {
        let index = exportArr.findIndex(child => {
          return item == child.label;
        })
        if (index != -1) {
          field_list.push(exportArr[index].value);
        }
      })
      this.exportChangeExcel({
        field_list,
        project_name: formSearch.project_name,
        project_number: formSearch.project_number,
        brand_id: formSearch.brand_id,
        store_type_id: formSearch.store_type_id,
        increase_or_decrease: formSearch.increase_or_decrease,
        created_at_start: formSearch.created_at ? formSearch.created_at[0] : '',
        created_at_end: formSearch.created_at ? formSearch.created_at[1] : '',
        quotation_at_start: formSearch.quotation_at ? formSearch.quotation_at[0] : '',
        quotation_at_end: formSearch.quotation_at ? formSearch.quotation_at[1] : '',
      })
    },
    exportChangeExcel(obj) {
      this.exportLoading = true;
      preSettlementApi.exportChangeExcel(obj).then(res => {
        console.log(res, "导出增减项列表")
        this.exportLoading = false;
        if (res.code == 200) {
          this.exportUrl = res.data;
        }
        this.$message({
          type: res.code == 200 ? 'success' : 'warning',
          message: res.message
        })
      })
    },
    // 导出字段全选
    allCheckedChangeFunc(e) {
      let exportrVal = [];
      console.log(e)
      let exportArr = this.exportArr;
      if (e) {
        exportArr.forEach(item => {
          exportrVal.push(item.label);
        })
        this.exportrVal = exportrVal//已选择字段
      } else {
        this.exportrVal = exportrVal//已选择字段
      }
    },
    // 关闭导出弹窗
    exportCloseFunc() {
      this.exportVisible = false;
      this.allChecked = false;
      this.exportrVal = [];
      this.exportUrl = '';
    },
    // 按钮权限
    bottonDisabled(where1, where2) {
      let multipleSelection = this.multipleSelection;
      if (multipleSelection.length != 1) return true
      let position_id = this.userInfo.position_id
      let change_status = multipleSelection[0].change_status
      // position_id == where1 && 
      if (change_status == where2) {
        return false
      }
      return true
    },
    // 单页数据量修改
    handleSizeChange(e) {
      this.num = e;
      this.onSearch(1);
    },
    // 搜索
    onSearch(page) {
      this.page = typeof page == 'number' ? page : this.page;
      this.getList();
    },
    // 翻页
    handleCurrentChange(page) {
      this.onSearch(page);
    },
    moreSearchFunc() {
      this.moreSearchShow = !this.moreSearchShow;
      this.$nextTick(() => {
        this.handleResize();
      })
    },
    addFunc() {
      this.$store.commit('isEventTriggeredFunc', true);
      this.$router.push({
        path: "/increaseDecreaseItemsAdd"
      })
    },
    goToDetail(row) {
      this.$store.commit('isEventTriggeredFunc', true);
      this.$router.push({
        path: '/increaseDecreaseItemsInfo',
        query: {
          sn: row.id
        }
      })
    },
    editFunc(type) {
      let item = this.multipleSelection[0];

      if (type == 0) {
        if (this.adminList.length == 0) {
          this.getAdminList()
        }
        this.changeManVisible = true;
        return
      }
      let path = ''
      switch (type) {
        case 1:
          path = '/idiQuotation'
          break
        case 2:
          path = '/increaseDecreaseItemsInfo'
          break
        case 3:
          path = '/increaseDecreaseItemsInfo'
          break
        case 4:
          path = '/increaseDecreaseItemsInfo'
          break
      }
      this.$store.commit('isEventTriggeredFunc', true);
      this.$router.push({
        path,
        query: {
          sn: item.id,
          examine: true,
          change_status: item.change_status
        }
      })
    },
    delFunc() {
      let multipleSelection = this.multipleSelection;
      let id_arr = multipleSelection.map(item => item.id)
      let name_arr = multipleSelection.map(item => item.name)
      this.$confirm('是否删除【' + name_arr.join(', ') + '】?', "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        console.log(id_arr)
      }).catch(() => { });

    },
    handleSelectionChange(e) {
      console.log(e);
      this.multipleSelection = e;
    },
    handleHighlightChangeTable(row) {
      if (!row.disabled) {
        this.$refs.table.toggleRowSelection(row);
      }
    },
    // 修改造价员
    changeManCancelFunc() {
      this.changeManVisible = false
      this.changeManForm.admin_id = ''
    },
    changeManSubmit() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          this.changeLoading = true;
          idiApi.changeItemsAssignCostEstimator({
            project_id: this.multipleSelection[0].project_id,
            change_id: this.multipleSelection[0].id,
            cost_estimator_id: this.changeManForm.admin_id,
          }).then(res => {
            if (res.code == 200) {
              this.changeManCancelFunc();
            }
            this.changeLoading = false;
            this.$message({
              type: res.code == 200 ? "success" : "warning",
              message: res.code == 200 ? "操作成功" : res.message,
            });
          })
        }
      });
    },

    // brandList: [],
    // storeList: [],
    // 获取列表数据
    getList() {
      this.tableLoading = true;
      let formSearch = this.formSearch
      idiApi.getChangeList({
        page: this.page,
        num: this.num,
        to_do: formSearch.to_do || 0,
        project_name: formSearch.project_name,
        project_number: formSearch.project_number,
        brand_id: formSearch.brand_id,
        store_type_id: formSearch.store_type_id,
        increase_or_decrease: formSearch.increase_or_decrease,
        created_at_start: formSearch.created_at ? formSearch.created_at[0] : '',
        created_at_end: formSearch.created_at ? formSearch.created_at[1] : '',
        quotation_at_start: formSearch.quotation_at ? formSearch.quotation_at[0] : '',
        quotation_at_end: formSearch.quotation_at ? formSearch.quotation_at[1] : '',
        quotation_validity: formSearch.quotation_validity || '',
      }).then((res) => {
        console.log(res, "获取列表");
        this.tableLoading = false;
        if (res.code == 200) {
          this.tableData = res.data.list;
          this.total = res.data.max;
        }
      }).catch((err) => {
        this.$message({
          message: err.message,
          type: "warning",
        });
      });
    },
    // 获取品牌
    getBrandList() {
      brandApi.getBrandList({
        page: 1,
        num: 999,
      }).then(res => {
        console.log(res, "品牌列表")
        if (res.code == 200) {
          this.brandList = res.data.list;
        }
      })
    },
    // 获取门店类型
    getStoreList() {
      storeTypeApi.getStoreTypeList({
        page: 1,
        num: 999,
      }).then((res) => {
        console.log(res, "获取门店列表");
        if (res.code == 200) {
          this.storeList = res.data.list;
        }
      })
    },

    // 重新分配造价员
    getAdminList() {
      adminApi.getAdminList({
        page: 1,
        num: 99,
        identity: 1,
        position_id_arr: [5],
      }).then(res => {
        console.log(res, '获取造价员列表')
        if (res.code == 200) {
          this.adminList = res.data.list;
        }
      })
    },
    // 增减项作废
    changeInvalidationFunc() {
      let multipleSelection = this.multipleSelection[0];
      this.$confirm('是否作废该增减项?', "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        idiApi.changeInvalidation({
          change_id: multipleSelection.id,
          project_id: multipleSelection.project_id,
        }).then(res => {
          if (res.code == 200) {
            this.onSearch();
          }
          this.$message({
            type: res.code == 200 ? "success" : "warning",
            message: res.code == 200 ? "操作成功" : res.message,
          });
        })
      }).catch(() => { });
    },
  },
};
</script>

<style lang="scss" scoped>
// @import "./index.scss";
@import '@/styles/listPage.scss';

.input-box,
.change-man-input {
  width: 340px;
}
</style>